import java.text.DateFormat;
import java.text.ParseException;
import java.util.*;

public class PersonalData
{
    private PersonalData()
    {
        name = "";
        lastName = "";
        gender = MALE;
        occupation = "";
        coachsName = "";
        sport = "";
        category = "";
        institution = "";
        dateBirth = new Date();
    }
    public String getName()
    {
        return name;
    }
    public String getLastName()
    {
        return lastName;
    }
    public String getGender()
    {
        return gender;
    }
    public String getOccupation()
    {
        return occupation;
    }
    public String getCoachsName()
    {
        return coachsName;
    }
    public String getSport()
    {
        return sport;
    }
    public String getCategory()
    {
        return category;
    }
    public String getInstitution()
    {
        return institution;
    }
    public Date getDateBirth()
    {
        return dateBirth;
    }
    public static PersonalData getPersonalData()
    {
        return new PersonalData();
    }
    public void setName(String name_)
    {
        name = name_;
    }
    public void setLastName(String lastName_)
    {
        lastName = lastName_;
    }
    public void setGender(String gender_)
    {
        if(gender_.equals(PersonalData.MALE)||gender_.equals(PersonalData.FEMALE))
            gender = gender_;
    }
    public void setOccupation(String occupation_)
    {
        occupation = occupation_;
    }
    public void setCoachsName(String coachsName_)
    {
        coachsName = coachsName_;
    }
    public void setSport(String sport_)
    {
        sport = sport_;
    }
    public void setCategory(String category_)
    {
        category = category_;
    }
    public void setInstitution(String institution_)
    {
        institution = institution_;
    }
    public void setDateBirth(Date dateBirth_)
    {
        dateBirth = dateBirth_;
    }
    public void setValue (ID.PD id, String value)
    {
        switch(id)
        {
            case NAME:
                setName(value);
                break;
            case LAST_NAME:
                setLastName(value);
                break;
            case GENDER:
                setGender(value);
                break;
            case OCCUPATION:
                setOccupation(value);
                break;
            case COACHS_NAME:
                setCoachsName(value);
                break;
            case SPORT:
                setSport(value);
                break;
            case CATEGORY:
                setCategory(value);
                break;
            case INSTITUTION:
                setInstitution(value);
                break;
            case DATE_BIRTH:
                try{
                    DateFormat df = 
                        DateFormat.getDateInstance(
                            DateFormat.SHORT, 
                            new Locale("es","MX")
                        );
                    setDateBirth(df.parse(value));
                }catch(ParseException e){e.printStackTrace();}
                break;
            default:
                return;
        }
    }
    public static final String MALE = "male";
    public static final String FEMALE = "female";
    private String name;
    private String lastName;
    private String gender;
    private String occupation;
    private String coachsName;
    private String sport;
    private String category;
    private String institution;
    private Date dateBirth;
}